package cn.iocoder.yudao.module.fm.dal.mysql.subgrade;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.fm.dal.dataobject.bridge.BridgeDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.fm.controller.admin.bridge.vo.*;

/**
 * 路基 Mapper
 *
 * @author 档案
 */
@Mapper
public interface BridgeMapper extends BaseMapperX<BridgeDO> {

    default PageResult<BridgeDO> selectPage(BridgePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BridgeDO>()
                .likeIfPresent(BridgeDO::getHoleNumber, reqVO.getHoleNumber())
                .likeIfPresent(BridgeDO::getQrCode, reqVO.getQrCode())
                .likeIfPresent(BridgeDO::getTypeOfStructure, reqVO.getTypeOfStructure())
                .likeIfPresent(BridgeDO::getLength, reqVO.getLength())
                .likeIfPresent(BridgeDO::getTeamLeader, reqVO.getTeamLeader())
                .likeIfPresent(BridgeDO::getFieldTechnicalLeader, reqVO.getFieldTechnicalLeader())
                .likeIfPresent(BridgeDO::getHeadOfSite, reqVO.getHeadOfSite())
                .likeIfPresent(BridgeDO::getQualityInspector, reqVO.getQualityInspector())
                .likeIfPresent(BridgeDO::getEngineerOfSupervision, reqVO.getEngineerOfSupervision())
                .betweenIfPresent(BridgeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BridgeDO::getId));
    }

    default List<BridgeDO> selectList(BridgeExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BridgeDO>()
                .likeIfPresent(BridgeDO::getHoleNumber, reqVO.getHoleNumber())
                .likeIfPresent(BridgeDO::getQrCode, reqVO.getQrCode())
                .likeIfPresent(BridgeDO::getTypeOfStructure, reqVO.getTypeOfStructure())
                .likeIfPresent(BridgeDO::getLength, reqVO.getLength())
                .likeIfPresent(BridgeDO::getTeamLeader, reqVO.getTeamLeader())
                .likeIfPresent(BridgeDO::getFieldTechnicalLeader, reqVO.getFieldTechnicalLeader())
                .likeIfPresent(BridgeDO::getHeadOfSite, reqVO.getHeadOfSite())
                .likeIfPresent(BridgeDO::getQualityInspector, reqVO.getQualityInspector())
                .likeIfPresent(BridgeDO::getEngineerOfSupervision, reqVO.getEngineerOfSupervision())
                .betweenIfPresent(BridgeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BridgeDO::getId));
    }

}
